<?php
/*
 * Copyright (c) 2021.  Liuhongbin All rights reserved.
 * @domain http://dkyx.cc
 * @author liuhongbin <514660094@qq.com>
 */

namespace hiduoke\services\sms\driver;

use hiduoke\base\BaseSms;

class Tenxun extends BaseSms
{

    protected function initialize(array $config)
    {
        parent::initialize($config);
        $this->name = 'qcloud';
    }

    public function app()
    {
        $gateways_config = array(
            'sdk_app_id' => $this->config['tenxun_app_id'], // SDK APP ID
            'secret_id'    => $this->config['tenxun_id'], // APP KEY
            'secret_key'    => $this->config['tenxun_key'], // APP KEY
            'sign_name'  => $this->config['tenxun_sign'], // 短信签名，如果使用默认签名，该字段可缺省（对应官方文档中的sign）
        );
        return $this->setGateways($this->name, $gateways_config);
    }

    public function send($to, $message)
    {
        return $this->app()->send($to, $message);
    }
}
